package com.yonyou.pmclouds.picture.mapper;

import com.yonyou.pmclouds.basecom.dao.BaseMapper;
import com.yonyou.pmclouds.basecom.entity.KeyCountVO;
import com.yonyou.pmclouds.picture.entity.PictureVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.Set;

public interface PictureMapper extends BaseMapper<PictureVO> {

    @Select("select * from pmbd_picture where dr = 0 and pk_entity = #{pk_entity} order by sequence")
    @ResultMap("getMap")
    PictureVO[] queryPicByPkEntity(String pk_entity);

    PictureVO[] queryPicsByPkEntitys(@Param("ids") String[] pk_entitys);

    PictureVO[] queryByPkEntityAndPicNames(@Param("pk_entity") String pk_entity,
                                           @Param("picNames") String[] picNames);

    PictureVO[] queryByPkBills(@Param("pkBills") String[] pkBills);

    int updateStatusByPkBill(@Param("pkBill") String pkBill, @Param("status") byte status);

    int countProjectPics(@Param("projects") String[] projects, @Param("billTypes") String[] excludeBillTypes,
                         @Param("noneStatusBillTypes") String[] noneStatusBillTypes,
                         @Param("start") Date start, @Param("end") Date end);

    KeyCountVO[] countPerProjectPics(@Param("projects") String[] projects, @Param("billTypes") String[] excludeBillTypes,
                                     @Param("noneStatusBillTypes") String[] noneStatusBillTypes,
                                     @Param("start") Date start, @Param("end") Date end);

    KeyCountVO[] countPerProjectBillTypePics(@Param("project") String project, @Param("billTypes") String[] excludeBillTypes,
                                             @Param("noneStatusBillTypes") String[] noneStatusBillTypes,
                                             @Param("start") Date start, @Param("end") Date end);

    PictureVO[] queryExamplesByBill(@Param("pkBill") String pkBill);

    PictureVO[] queryExamplePicsByEntity(@Param("pkEntity") String pkEntity);

    PictureVO[] queryByLargePkEntities(@Param("set")Set<Set<String>> pkEntities);
}
